<style lang="less">
    .selectOption .ivu-select-dropdown-list {
        max-height: 300px;
        overflow: auto;
    }
</style>
<template>
    <div class="search">
        <Row>
            <Col>
                <Card>
                    <Row>
                        <Form ref="searchForm" :model="searchForm" inline :label-width="130" class="search-form"
                              style="width: 100%">
                            <Row>
                                <i-col span="8"  style="display: none">
                                    <Form-item label="挂靠类型" prop="busiType" >
                                        <Select v-model="searchForm.busiType" disabled placeholder="第三方公司" clearable
                                                style="    width: 180px;">
                                        </Select>
                                    </Form-item>

                                </i-col>
                                <i-col span="8">
                                    <Form-item label="合作商名称" prop="channelName">
                                        <Select class="selectOption" v-model="searchForm.channelName" filterable clearable
                                                style="width: 180px">
                                            <Option v-for="item in channelList" :value="item.channelFullName" :key="item.id">{{ item.channelFullName }}</Option>
                                        </Select>
                                    </Form-item>

                                </i-col>
                                <i-col span="8">
                                    <Form-item label="挂靠公司名称" prop="affiliatedName">
                                        <Input type="text" v-model="searchForm.affiliatedName" clearable
                                               placeholder="请输入"
                                               style="width: 180px;"/>
                                    </Form-item>
                                </i-col>
                                <i-col span="8">
                                    <Form-item label="营业期限截止日期" >
                                        <DatePicker v-bind:disabled="disabled" v-model="selectDate" type="daterange"
                                                    format="yyyy-MM-dd" clearable
                                                    @on-change="selectDateRange" placeholder="选择起始时间"
                                                    style="    width:180px;"></DatePicker>
                                        <Checkbox v-model="searchForm.isOrNotLong" @on-change="selectCheck">长期
                                        </Checkbox>
                                        <a id="dropOne" class="drop-down" @click="dropDown">{{dropDownContent}}
                                            <Icon :type="dropDownIcon"></Icon>
                                        </a>
                                    </Form-item>

                                </i-col>

                            </Row>
                            <span v-if="drop">
                                <Row>
                                    <i-col span="8">
                                        <Form-item label="统一社会信用代码" prop="socUniCrtCode">
                                            <Input type="text" v-model="searchForm.socUniCrtCode" clearable placeholder="请输入" style="width: 180px"/>
                                        </Form-item>
                                    </i-col>
                                     <i-col span="8">
                                         <Form-item label="状态" prop="status">
                                             <Select v-model="searchForm.status" placeholder="请选择" clearable style="width: 180px">
                                                 <Option v-for="item in statusList" :value="item.value" :key="item.value">{{ item.title }}</Option>
                                             </Select>
                                         </Form-item>
                                     </i-col>
                                     <i-col span="8">
                                         <Form-item label="渠道归属" prop="channelBelong">
                                             <Select v-model="searchForm.channelBelong"
                                                     @on-change="changeChannelBelong(searchForm.channelBelong)" placeholder="请选择"
                                                     clearable style="width: 180px">
                                                 <Option v-for="item in channelBelongList" :value="item.value" :key="item.value">{{ item.title }}</Option>
                                             </Select>
                                         </Form-item>
                                     </i-col>
                                </Row>

                            </span>
                            <Row style="text-align: center;margin-left: 0">
                                <Form-item :label-width="0">
                                    <Button @click="handleSearch" type="primary" style=" border: none;" icon="ios-search">
                                        查询
                                    </Button>
                                    <Button @click="handleReset" icon="md-redo">重置</Button>

                                </Form-item>
                            </Row>
                        </Form>
                    </Row>
                    <Row class="operation">
                        <Button v-if="businessManage!=null||ownBusinessManage!=null" @click="add" type="primary" icon="md-add" style=" border: none">新增申请</Button>
                        <Button v-if="businessManage!=null||ownBusinessManage!=null" @click="stop" type="error" icon="md-remove-circle">批量停用</Button>
                        <circleLoading v-if="operationLoading"/>
                    </Row>
                    <Row>
                        <Table :loading="loading" border :columns="columns" :data="data" sortable="custom"
                               @on-sort-change="changeSort" @on-selection-change="showSelect" ref="table">
                            <template slot-scope="{ row, index }" slot="action">
                                <div v-if="row.status==='00'">
                                  <span v-if="businessManage!=null || ownBusinessManage!=null ">
                                    <Button style="margin-right:5px" type="primary" size="small" @click="edit(row)">编辑
                                    </Button>
                                  </span>
                                    <span v-if="businessManage!=null || ownBusinessManage!=null ">
                                    <Button style="margin-right:5px;" disabled size="small">删除
                                    </Button>
                                    </span>
                                </div>
                                <div v-if="row.status==='01'">
                                    <Button style="margin-right:5px;" disabled size="small">编辑
                                    </Button>
                                    <Button style="margin-right:5px;" disabled size="small">删除
                                    </Button>
                                </div>
                                <div v-if="row.status==='02'">
                                  <span v-if="businessManage!=null || ownBusinessManage!=null ">
                                    <Button style="margin-right:5px" type="primary" size="small" @click="edit(row)">编辑
                                    </Button>
                                  </span>
                                    <span v-if="businessManage!=null || ownBusinessManage!=null ">
                                    <Button style="margin-right:5px" type="error" size="small" @click="deleteById(row)">
                                        删除
                                    </Button>
                                    </span>
                                </div>
                                <div v-if="row.status==='03'">
                                    <span v-if="businessManage!=null || ownBusinessManage!=null ">
                                    <Button style="margin-right:5px;" type="primary" size="small" @click="edit(row)">编辑
                                    </Button>
                                    </span>
                                    <span v-if="businessManage!=null || ownBusinessManage!=null ">
                                    <Button style="margin-right:5px;" disabled size="small">删除
                                    </Button>
                                    </span>
                                </div>
                                <div v-if="row.status==='04'">
                                    <Button style="margin-right:5px;" disabled size="small">编辑
                                    </Button>
                                    <Button style="margin-right:5px;" disabled size="small">删除
                                    </Button>
                                </div>
                                <div v-if="row.status==='05'">
                                    <span v-if="businessManage!=null || ownBusinessManage!=null ">
                                    <Button style="margin-right:5px" type="primary" size="small" @click="edit(row)">编辑
                                    </Button>
                                    </span>
                                    <span v-if="businessManage!=null || ownBusinessManage!=null ">
                                    <Button style="margin-right:5px;" disabled size="small">删除
                                    </Button>
                                    </span>
                                </div>
                            </template>
                            <template slot-scope="{ row, index }" slot="affiliatedName">
                                <a type="primary" size="small" @click="show(row)">{{row.affiliatedName}}
                                </a>
                            </template>
                            <template slot-scope="{ row, index }" slot="channelNumber">
                                <a type="primary" size="small" @click="showChannelName(row)">{{row.channelNumber}}
                                </a>
                            </template>
                            <template slot-scope="{ row, index }" slot="registeredAddress">
                                <span>{{getDetailAddress(row.registeredProvince,row.registeredCity,row.registeredAddress)}}</span>
                            </template>
                            <template slot-scope="{ row, index }" slot="status">
                                <div v-if="row.status === '00'">
                                    <Tag color="success" size="default">启用</Tag>
                                </div>
                                <div v-else-if="row.status === '01'">
                                    <Tag color="warning" size="default">审核中</Tag>
                                </div>
                                <div v-else-if="row.status === '02'">
                                    <Tag color="default" size="default">草稿</Tag>
                                </div>
                                <div v-else-if="row.status === '03'">
                                    <Tag color="warning" size="default">退回</Tag>
                                </div>
                                <div v-else-if="row.status === '04'">
                                    <Tag color="error" size="default">拒绝</Tag>
                                </div>
                                <div v-else>
                                    <Tag color="error" size="default">停用</Tag>
                                </div>
                            </template>
                            <template slot-scope="{ row, index }" slot="busiType">
                                <div v-if="row.busiType === '01'">
                                    第三方公司
                                </div>
                            </template>
                        </Table>
                    </Row>
                    <Row type="flex" justify="end" class="page">
                        <Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize"
                              @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10,20,50]"
                              size="small" show-total show-elevator show-sizer></Page>
                    </Row>
                </Card>
            </Col>
        </Row>
        <Modal v-model="userModalVisible" :mask-closable='false' :width="500" :styles="{top: '180px'}">
            <Table :columns="columnsChannel" :data="dataChannel">
                <template slot-scope="{ row, index }" slot="status">
                    <div v-if="row.status === '00'">
                        <Tag color="success" size="default">启用</Tag>
                    </div>
                    <div v-else-if="row.status === '01'">
                        <Tag color="warning" size="default">审核中</Tag>
                    </div>
                    <div v-else-if="row.status === '02'">
                        <Tag color="default" size="default">草稿</Tag>
                    </div>
                    <div v-else-if="row.status === '03'">
                        <Tag color="warning" size="default">退回</Tag>
                    </div>
                    <div v-else-if="row.status === '04'">
                        <Tag color="error" size="default">拒绝</Tag>
                    </div>
                    <div v-else>
                        <Tag color="error" size="default">停用</Tag>
                    </div>
                </template>
            </Table>
            <div slot="footer" style="display: none">
            </div>
        </Modal>
    </div>
</template>

<script>
    import {
        getAffiliationInfo,
        upDateStatusByIds,
        getChannelFullName,
        upDateCaseStatusByIds,
        deleteInfo,
        // getLocation
    } from "@/projects/afs-channel/api/affiliation/affiliation";
    import {getLocation, getBaseInfo} from "@/projects/afs-channel/api/common/common";
    import circleLoading from "_c/circle-loading/circle-loading.vue";
    import {getDictDataByType} from "@/projects/basic/api/admin/datadic";
    import { getBaseInfoByRole } from "@/projects/afs-channel/api/common/common";

    export default {
        name: "user-manage",
        components: {
            circleLoading
        },
        data() {
            return {
                // 下面是用于权限控制的 01:代表新车  02 代表二手车  03代表新车二手车都有
                businessType: null,
                ownBusinessType: null,

                // 下面是代表管理员的权限 01:代表新车  02 代表二手车  03代表新车二手车都有
                businessManage: null,
                ownBusinessManage: null,
                controlBelong: '03',
                loading: true,
                operationLoading: false,
                importLoading: false,
                loadingExport: true,
                disabled: null,
                userModalVisible: false,
                statusList: [],
                channelBelongList: [],
                channelList: [],
                selectBelong: '',
                drop: false,
                dropDownContent: "更多",
                dropDownIcon: "ios-arrow-down",
                viewImage: false,
                searchForm: {
                    busiType: "",
                    affiliatedName: "",
                    pageNumber: 1,
                    pageSize: 10,
                    socUniCrtCode: "",
                    status: "",
                    channelBelong: "",
                    channelName: "",
                    startDate: "",
                    endDate: "",
                    isOrNotLong: ""
                },
                selectDate: null,
                modalType: 0,
                selectList: [],
                location: [],
                longTime: '',
                turn: '',
                selectCount: 0,
                modalTitle: "",
                login: "SP",
                errorPass: "",
                province: [],
                city: [],
                submitLoading: false,
                columns: [
                    {
                        type: "selection",
                        minWidth: 60,
                        maxWidth: 60,
                        align: "center",
                        fixed: "left"
                    }, {
                        title: '序号',
                        type: 'index',
                        width: 80,
                        align: 'center',
                        ellipsis: true,
                        tooltip: true,
                        fixed: "left"
                    }, {
                        title: "挂靠类型",
                        key: "busiType",
                        align: "center",
                        minWidth: 120,
                        slot: "busiType",
                        fixed: "left"
                    },
                    {
                        title: "挂靠公司名称",
                        key: "affiliatedName",
                        align: "center",
                        minWidth: 145,
                        slot: "affiliatedName",
                        fixed: "left"
                    },
                    {
                        title: "合作商数量",
                        key: "channelNumber",
                        align: "center",
                        minWidth: 120,
                        slot: "channelNumber"
                    },
                    {
                        title: "统一社会信用代码",
                        key: "socUniCrtCode",
                        align: "center",
                        minWidth: 140
                    },
                    {
                        title: "月单剩余数",
                        key: "monthlySurplusNum",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "总单剩余数",
                        key: "totalSurplusNum",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "成立时间",
                        key: "foundedTime",
                        sortable: true,
                        align: "center",
                        minWidth: 150
                    },
                    {
                        title: "法人姓名",
                        key: "legalPersonName",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "注册地址",
                        key: "registeredAddress",
                        align: "center",
                        minWidth: 180,
                        slot: "registeredAddress"
                    },
                    {
                        title: "注册资本",
                        key: "registeredCapital",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "是否道路运输许可",
                        key: "whetherLicence",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "营业期限截止时间",
                        key: "oprTermValidity",
                        align: "center",
                        minWidth: 150
                    },
                    {
                        title: "状态",
                        key: "status",
                        align: "center",
                        minWidth: 100,
                        slot: "status"
                    },
                    {
                        title: "操作",
                        key: "action",
                        minWidth: 150,
                        align: "center",
                        fixed: "right",
                        slot: "action"
                    }
                ],
                data: [],
                columnsChannel: [
                    {
                        title: "名称",
                        key: "channelFullName",
                        align: "center",
                        minWidth: 140,
                    },
                    {
                        title: "渠道归属",
                        key: "channelBelong",
                        align: "center",
                        minWidth: 60,
                    },
                    {
                        title: "状态",
                        key: "status",
                        align: "center",
                        minWidth: 60,
                        slot: "status"
                    }
                ],
                dataChannel: [],
                total: 0
            };
        },
        watch: {
            '$route'(to, from) {
                if (from.path.indexOf("third-add") > -1 || from.path.indexOf("ThirdEdit") > -1 || from.path.indexOf("ThirdExamine") > -1) {
                    this.getAffiliationList(this.searchForm.pageNumber, this.searchForm.pageSize);
                }
            }
        },
        methods: {
            init() {
                this.getRole();
                this.getAffiliationList();
                this.getProvinceData();
                this.getCityData();
                this.getManage();
            },
            getManage(){
                // 判断是管理员  全都可以操作
                if (this.$store.state.user.roles.toString().indexOf("ROLE_ADMIN") != -1) {
                    this.businessManage = "03";
                    this.ownBusinessManage = "03";
                    console.log("我是管理员");
                } else {
                    // 说明不是管理员 那么需要判断他有哪些管理角色
                    if (
                        this.$store.state.user.roles
                            .toString()
                            .indexOf("ROLE_OTHER_MANAGE_THIRD_AFFILIATED") != -1
                    ) {
                        // 说明是非直营管理
                        this.businessManage = "03";
                        console.log("我是非直营挂靠管理");
                    }

                    // 再去判断直营的角色属性
                    if (
                        this.$store.state.user.roles
                            .toString()
                            .indexOf("ROLE_OWN_MANAGE_THIRD_AFFILIATED") != -1
                    ) {
                        //我是直营的属性
                        this.ownBusinessManage = "03";
                        console.log("我是直营挂靠管理");
                    }
                }
            },
            // 查询自己的权限
            getRole() {
                console.log("我要过来判断权限");
                console.log(this.$store.state.user.roles.toString());
                // 判断是管理员  全都可以操作
                if (this.$store.state.user.roles.toString().indexOf("ROLE_ADMIN") != -1) {
                    this.businessType = "03";
                    this.ownBusinessType = "03";
                    console.log("我是管理员");
                } else {
                    // 说明不是管理员 那么需要判断他有哪些管理角色
                    if (
                        this.$store.state.user.roles
                            .toString()
                            .indexOf("ROLE_OTHER_MANAGE_THIRD_AFFILIATED") != -1 ||this.$store.state.user.roles
                            .toString()
                            .indexOf("ROLE_OTHER_SEE_THIRD_AFFILIATED") != -1
                    ) {
                        // 说明是非直营管理
                        this.businessType = "03";
                        console.log("我是非直营");
                    }

                    // 再去判断直营的角色属性
                    if (
                        this.$store.state.user.roles
                            .toString()
                            .indexOf("ROLE_OWN_MANAGE_THIRD_AFFILIATED") != -1 ||this.$store.state.user.roles
                            .toString()
                            .indexOf("ROLE_OWN_SEE_THIRD_AFFILIATED") != -1
                    ) {
                        //我是直营的属性
                        this.ownBusinessType = "03";
                        console.log("我是直营");
                    }
                }
                this.getBaseInfoByRole();
            },
            // 获取合作商信息接口
            getBaseInfoByRole() {
                let param = {
                    status: null,
                    channelId: null,
                    businessType:this.businessType,
                    ownBusinessType:this.ownBusinessType
                };
                getBaseInfoByRole(param).then(res => {
                    this.loading = false;
                    if (res.code === "0000") {
                        this.channelList = res.data;
                    }
                });
            },
            getProvinceData() {
                let param = {level: "1", upperCode: "1"};

                getLocation(param).then(res => {
                    if (res.code === "0000") {
                        this.province = res.data;
                    }
                });
            },
            getCityData() {
                let param = {level: 2, upperCode: ''};
                getLocation(param).then(res => {
                    if (res.code == "0000") {
                        this.city = res.data;
                    }
                });
            },
            //改变当前页码
            changePage(v) {
                this.searchForm.pageNumber = v;
                this.getAffiliationList(v, 10);
            },
            //改变页码数量
            changePageSize(v) {
                this.searchForm.pageSize = v;
                this.getAffiliationList(1, v);
            },
            //选择时间期止
            selectDateRange(v) {
                if (v) {
                    this.longTime = "0";
                    this.searchForm.startDate = v[0];
                    this.searchForm.endDate = v[1];
                }
            },
            //查询条件
            getAffiliationList(pageNumber = 1, pageSize = 10) {
                let params = {
                    pageNumber: pageNumber,
                    pageSize: pageSize,
                    busiType: "01",
                    startDate: this.searchForm.startDate,
                    endDate: this.searchForm.endDate,
                    affiliatedName: this.searchForm.affiliatedName,
                    socUniCrtCode: this.searchForm.socUniCrtCode,
                    status: this.searchForm.status,
                    channelBelong: this.searchForm.channelBelong,
                    channelName: this.searchForm.channelName,
                    isOrNotLong: this.longTime,
                    isOrNotApply: "0"
                };
                getAffiliationInfo(params).then(res => {
                    this.loading = false;
                    if (res.code === "0000") {
                        for (let i = 0; i < res.data.records.length; i++) {
                            let oprTermValidity = res.data.records[i].oprTermValidity;
                            let monthlyNum = "";
                            if (typeof res.data.records[i].monthlySurplusNum != "undefined" && typeof res.data.records[i].monthlyApplicationNum != "undefined") {
                                monthlyNum = res.data.records[i].monthlySurplusNum + "/" + res.data.records[i].monthlyApplicationNum;
                            }
                            res.data.records[i].monthlySurplusNum = monthlyNum;
                            let totalNum = "";
                            if (typeof res.data.records[i].totalSurplusNum != "undefined" && typeof res.data.records[i].totalApplicationNum != "undefined") {
                                totalNum = res.data.records[i].totalSurplusNum + "/" + res.data.records[i].totalApplicationNum;
                            }
                            res.data.records[i].totalSurplusNum = totalNum;
                            if (typeof oprTermValidity == "undefined" || res.data.records[i].longTermOrNot == "1") {
                                res.data.records[i].oprTermValidity = "长期";
                            }
                            let whetherLicence = res.data.records[i].whetherLicence;
                            if (whetherLicence == "1") {
                                res.data.records[i].whetherLicence = "是";
                            } else if (whetherLicence == "0") {
                                res.data.records[i].whetherLicence = "否";
                            }
                        }
                        this.data = res.data.records;
                        this.total = res.data.total;
                    }
                });
            },
            //查询按钮操作
            handleSearch() {
                this.loading=true;
                this.searchForm.pageNumber = 1;
                this.searchForm.pageSize = 10;
                this.getAffiliationList();
            },
            showSelect(e) {
                this.selectList = e;
                this.selectCount = e.length;
            },
            clearSelectAll() {
                this.$refs.table.selectAll(false);
            },

            // 停用
            stop() {
                if (this.selectCount <= 0) {
                    this.$Message.warning("您还未选择要停用的挂靠公司");
                    return;
                }
                for (let i = 0; i < this.selectList.length; i++) {
                    if (this.selectList[i].status != '00') {
                        this.$Message.warning("仅能停用已启用状态的挂靠公司，请重新选择！");
                        this.clearSelectAll();
                        return;
                    }
                }
                this.$Modal.confirm({
                    title: "确认停用",
                    content: "您确认要停用所选的 " + this.selectCount + " 家挂靠公司?",
                    onOk: () => {
                        let ids = "";
                        this.selectList.forEach(function (e) {
                            ids += e.id + ",";
                        });
                        //ids = ids.substring(0, ids.length - 1);
                        this.operationLoading = true;
                        upDateStatusByIds(ids).then(res => {
                            this.operationLoading = false;
                            if (res.code === "0000") {
                                this.$Message.success("状态更新成功");
                                this.getAffiliationList(this.searchForm.pageNumber, this.searchForm.pageSize);
                                upDateCaseStatusByIds({id: ids});
                            }
                        });
                    }
                });
            },
            //重置按钮操作
            handleReset() {
                this.$refs.searchForm.resetFields();
                this.searchForm.pageNumber = 1;
                this.searchForm.pageSize = 10;
                this.selectDate = null;
                this.searchForm.startDate = "";
                this.searchForm.endDate = "";
                this.searchForm.ascription = "";
                this.searchForm.companyName = "";
                this.searchForm.partnerName = "";
                this.searchForm.isOrNotLong = false;
                this.disabled = null;
                this.longTime = "";
                // 重新加载数据
                // this.loading=true;
                // this.getAffiliationList();
            },
            getStatus() {
                let param = {
                    type: "affiliationStatus"
                };
                getDictDataByType(param.type).then(res => {
                    if (res.code === "0000") {
                        this.statusList = res.data;
                    }
                });
            },
            getChannelBelong() {
                let param = {
                    type: "channelBelong"
                };
                getDictDataByType(param.type).then(res => {
                    if (res.code === "0000") {
                        this.channelBelongList = res.data;
                    }
                });
            },
            changeSort(e) {
                this.searchForm.sort = e.key;
                this.searchForm.order = e.order;
                if (e.order === "normal") {
                    this.searchForm.order = "";
                }
                this.getAffiliationList();
            },
            add() {
                this.afs.newTab(this, 'projects/afs-channel/pages/affiliation-apply/affiliation-third/affiliationThirdAddEdit', '第三方挂靠新增', 'ios-add', {type: 1}, 'affiliation-third-add', [], true);
            },
            edit(v) {
                if (v.status == "02" || v.status == "05" || v.status == "00") {
                    let param = {
                        type: 2,
                        id: v.id,
                        updateStatus: v.status
                    }
                    this.turn = "affiliationThirdEdit" + v.id;
                    this.afs.newTab(this, 'projects/afs-channel/pages/affiliation-apply/affiliation-third/affiliationThirdAddEdit', '第三方挂靠修改', 'ios-add', param, this.turn, [], true);
                } else {
                    this.$Message.error("只可修改草稿或停用状态的挂靠公司!");
                }

            },
            show(v) {
                let param = {
                    type: 3,
                    id: v.id,
                    updateStatus: v.status
                }
                let turnPage = "affiliationThirdShow" + v.id;
                this.afs.newTab(this, 'projects/afs-channel/pages/affiliation-apply/affiliation-third/affiliationThirdAddEdit', '第三方挂靠查看', 'ios-add', param, turnPage, [], true);
            },
            deleteById(row) {
                this.$Modal.confirm({
                    title: "确认删除?",
                    onOk: () => {
                        let param = {
                            id: row.id
                        }
                        deleteInfo(param).then(res => {
                            if (res.code === "0000") {
                                this.$Message.success("删除成功");
                                this.getAffiliationList(this.searchForm.pageNumber, this.searchForm.pageSize);
                            }
                        });
                    }
                });
            },
            showChannelName(v) {
                let id = v.id;
                this.operationLoading = true;
                getChannelFullName({id: id}).then(res => {
                    if (res.code === "0000") {
                        let arr = [];
                        if (this.selectBelong == null || this.selectBelong == "") {
                            arr = res.data;
                            for (let i = 0; i < arr.length; i++) {
                                if (arr[i].channelBelong == "00") {
                                    arr[i].channelBelong = "SP";
                                } else if (arr[i].channelBelong == "01") {
                                    arr[i].channelBelong = "直营";
                                } else if (arr[i].channelBelong == "02") {
                                    arr[i].channelBelong = "总对总";
                                }
                            }
                        } else {
                            for (let i = 0; i < res.data.length; i++) {
                                if (res.data[i].channelBelong == this.selectBelong) {
                                    arr.push(res.data[i]);
                                }
                            }
                            for (let i = 0; i < arr.length; i++) {
                                if (arr[i].channelBelong == "00") {
                                    arr[i].channelBelong = "SP";
                                } else if (arr[i].channelBelong == "01") {
                                    arr[i].channelBelong = "直营";
                                } else if (arr[i].channelBelong == "02") {
                                    arr[i].channelBelong = "总对总";
                                }
                            }
                        }

                        this.dataChannel = arr;
                    }
                    this.operationLoading = false;
                });
                this.modalType = 0;
                this.userModalVisible = true;
            },
            dropDown() {
                if (this.drop) {
                    this.dropDownContent = "更多";
                    this.dropDownIcon = "ios-arrow-down";
                } else {
                    this.dropDownContent = "收起";
                    this.dropDownIcon = "ios-arrow-up";
                }
                this.drop = !this.drop;
            },
            selectCheck(value) {
                if (value) {
                    this.searchForm.selectDate = "";
                    this.longTime = "1";
                    this.searchForm.startDate = "";
                    this.searchForm.endDate = "";
                    this.disabled = "disabled";
                } else {
                    this.longTime = "";
                    this.disabled = null;
                    this.searchForm.selectDate = "";
                    this.searchForm.startDate = "";
                    this.searchForm.endDate = "";
                }
            },
            getDetailAddress(registeredProvince, registeredCity, registeredAddress) {
                if (registeredProvince != "" && registeredCity != "" && registeredAddress != "") {
                    let province = "";
                    let city = "";
                    for (let i = 0; i < this.province.length; i++) {
                        if (this.province[i].value == registeredProvince) {
                            province = this.province[i].label;
                        }
                    }
                    ;
                    for (let i = 0; i < this.city.length; i++) {
                        if (this.city[i].value == registeredCity) {
                            city = this.city[i].label;
                        }
                    }
                    ;
                    return province + city + registeredAddress;
                } else {
                    return '';
                }
            },
            changeChannelBelong(v) {
                if (v != null || v != "") {
                    this.selectBelong = v;
                }
            },
            getChannelList() {
                let params = {status: ""};
                getBaseInfo(params).then(res => {
                    this.operationLoading = false;
                    if (res.code === "0000") {
                        this.channelList = res.data;
                    }
                });
            },
        },
        mounted() {
            this.init();
            this.getStatus();
            // this.getChannelList();
            this.getChannelBelong();
        },

    };
</script>

<style scoped>

</style>
